/*
 * =====================================================================================
 *
 *       Filename:  duplicateTeleNumcount.cc
 *
 *    Description:  重复的电话号码的次数
 *
 *        Version:  1.0
 *        Created:  09/09/2012 11:42:32 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Regan (), lcqhigh@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */

//#include	<assert.h>
#include	<stdio.h>
#include	<stdlib.h>
#include	<ctype.h>
#include	<string.h>

static const int sonnum = 10;
typedef struct trieNode_s
{
    struct trieNode_s *link[sonnum];
    //bool terminal;
    int    count;
}trieNode;

trieNode trieRoot;
static int globalCount = 0;
static char mapTable[128];
trieNode globalTrieNodes[800008];
int globalFreeNodesIdx;

trieNode* newTrieNode()
{
    trieNode *temp = &globalTrieNodes[globalFreeNodesIdx];
    ++globalFreeNodesIdx;
    //temp->terminal = true;
    temp->count = 1;
    for (int i = 0; i < sonnum; ++i)
        temp->link[i] = NULL;
    return temp;
}

void trieInsert(trieNode *rootPtr, const char *str)
{
    if (rootPtr == NULL || str == NULL)
        return;
    trieNode *temp = rootPtr;
    const char *p = str;
    while (*p != '\0')
    {
        int idx = *p - '0';
        //assert(idx >= 0 && idx < sonnum);
        if (temp->link[idx] == NULL)
            temp->link[idx] = newTrieNode();
        else 
            temp->link[idx]->count++;
        //temp->terminal = false;
        temp = temp->link[idx];
        ++p;
    }
}

void out_put_res(char *buf, int count)
{
    putchar(buf[0]);
    putchar(buf[1]);
    putchar(buf[2]);
    putchar('-');
    putchar(buf[3]);
    putchar(buf[4]);
    putchar(buf[5]);
    putchar(buf[6]);
    putchar(' ');
    printf ( "%d\n", count);
}

void travelTrie(int depth, char *buf, trieNode *pRoot)
{
    if (depth == 7)
    {
       if (pRoot->count > 1) 
       {
           ++globalCount;
           out_put_res(buf, pRoot->count);
       }
       return;
    }

    for (int idx = 0; idx < sonnum; ++idx)
    {
        if (pRoot->link[idx] != NULL)
        {
            buf[depth] = '0' + idx;
            travelTrie(depth + 1, buf, pRoot->link[idx]);
        }
        buf[depth] = '\0';
    }
}

void getPhoneNum()
{
    trieNode *pRoot = &trieRoot;
    int depth = 0;
    char buf[16] = {'\0'};
    travelTrie(depth, buf, pRoot);
}


void createTableMap()
{
    for (int idx = 'A', key = 2; idx <= 'O';)
    {
        mapTable[idx] = key;
        mapTable[idx + 1] = key;
        mapTable[idx + 2] = key;
        ++key;
        idx += 3;
    }
    mapTable['P'] = mapTable['R'] = mapTable['S'] = 7;

    for (int idx = 'T', key = 8; idx <= 'Y'; )
    {
        mapTable[idx] = mapTable[idx + 1] = mapTable[idx + 2] = key;
        ++key;
        idx += 3;
    }
}

void getStandStr(char *dst, const char *src)
{
    const char *p = src;
    char *s = dst;
    while (*p != '\0')
    {
        if (isdigit(*p))
            *s++ = *p;
        else if (isupper(*p) && (*p) != 'Q' && (*p) != 'Z')
            *s++ = (mapTable[(int)(*p)] + '0');
        ++p;
    }
    *s = '\0';
}


static inline void putPhoneNumInDic(const char *phoneStr)
{
    //assert(strlen(phoneStr) == 7);
    trieInsert(&trieRoot, phoneStr);
}

int main(int argc, char *argv[])
{
    int T;
    //create the maptable
    createTableMap();
    char teleStr[316] = {'\0'};
    char standteleStr[16] = {'\0'};
    while (scanf("%d", &T) == 1) {
        //init the trie root
        trieRoot.count = 1;
        for (int i = 0; i < sonnum; ++i)
            trieRoot.link[i] = NULL;
        globalFreeNodesIdx = 0;
        //input the data
        while (T--) {
            //gets(teleStr);
            scanf("%s", teleStr);
            getStandStr(standteleStr, teleStr);
            //printf ( "the telephone num is :%s\n", standteleStr );
            putPhoneNumInDic(standteleStr);
        }
        globalCount = 0;
        getPhoneNum();
        if (globalCount == 0)
            printf ( "No duplicates.\n" );
    }
    return 0;
}
